﻿#pragma once

#include <Octets.h>

/**
 * 一个POD类型。
 */
struct LRUHandle{
	void* value;
	LRUHandle* next_hash;
	LRUHandle* next;
	uint32_t hash;      // Hash of key(); used for fast sharding and comparisons
	size_t key_length;
	char key_data[1];   // Beginning of key
	Octets key() const {
		// For cheaper lookups, we allow a temporary Handle object
		// to store a pointer to a key in "value".
		if (next == this) {
			return *(reinterpret_cast<Octets*>(value));
		} else {
			return Octets(key_data, key_length);
		}
	}
};
